﻿namespace Shared.Service.DataScopes
{
    /// <summary>
    /// 实体属性数据范围
    /// </summary>
    public class EntityPropertyDataScope : BaseDataScope
    {

        #region 构造函数

        /// <summary>
        /// 
        /// </summary>
        /// <param name="scopeType"></param>
        /// <param name="propertyName"></param>
        /// <param name="scopeKeys"></param>
        public EntityPropertyDataScope(DataScopeType scopeType, string propertyName, string[] scopeKeys)
        {
            ScopeType = scopeType;
            PropertyName = propertyName;
            ScopeKeys = scopeKeys;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="scopeType"></param>
        /// <param name="propertyName"></param>
        /// <param name="scopeKey"></param>
        public EntityPropertyDataScope(DataScopeType scopeType, string propertyName, string scopeKey) : this(
            scopeType, propertyName, new[] {scopeKey})
        {

        }

        #endregion

        /// <summary>
        /// 属性名称
        /// </summary>
        public virtual string PropertyName { get; }

        /// <summary>
        /// 数据范围类型
        /// </summary>
        public override DataScopeType ScopeType { get; }
        
        /// <summary>
        /// 数据范围所对应的Keys
        /// </summary>
        public override string[] ScopeKeys { get; set; }
    }
}
